package com.gexiaobao.pigeon.ui.fragment.mall.store

import android.os.Bundle
import com.gexiaobao.pigeon.R
import com.gexiaobao.pigeon.app.base.BaseFragment
import com.gexiaobao.pigeon.app.ext.initClose
import com.gexiaobao.pigeon.databinding.FragmentStoreInfoBinding
import com.gexiaobao.pigeon.viewmodel.MerchantStoresViewModel
import me.hgj.jetpackmvvm.ext.nav
import me.hgj.jetpackmvvm.ext.util.setOnclickNoRepeat

/**
 * @Author      : hxw
 * @Date        : 2023/7/10 9:06
 * @Describe    : 店铺详情
 */
class FragmentStoreInfo : BaseFragment<MerchantStoresViewModel, FragmentStoreInfoBinding>() {

    override fun initView(savedInstanceState: Bundle?) {
        mDatabind.includeBar.tvWhiteTitle.text = getString(R.string.store_detail)
    }

    override fun lazyLoadData() {
        super.lazyLoadData()
        val shopId = arguments?.getInt("shopId")
        shopId?.let { mViewModel.getAppShopIndex(it) }
    }

    override fun createObserver() {
        super.createObserver()
        /** 进店首页 */
        mViewModel.storeInfoResult.observe(viewLifecycleOwner) {
            mDatabind.data = it
        }
    }

    override fun onBindViewClick() {
        super.onBindViewClick()
        setOnclickNoRepeat(mDatabind.includeBar.ivBack) {
            nav().navigateUp()
        }
    }
}